﻿package com.gengine.utils
{

    public class ChatFraudFilter extends Object
    {
        private static var _source:Array = [];
        private static const LIMITVALUE:Number = 1;
        private static var reg:RegExp = new RegExp("[\\s█﹦﹢【】〖〗﹝﹞〔〕﹜﹛﹢＋≒＝（）]", "img");
        private static var DelReg:RegExp = new RegExp("[^IOlZz1234567890ｌＯЧㄹ１２３４５６７８９０①②③④⑤⑥⑦⑧⑨⑩⓪⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛ⅠⅡⅢⅣⅤⅥⅦⅧⅨ㈠㈡㈢㈣㈤㈥㈦㈧㈨⑴⑵⑶⑷⑸⑹⑺⑻⑼零壹贰叁肆伍陆柒捌玖一二三四五六七八九—十万百㍘㍙㍚㍛㍜㍝㍞㍟㍠㍡㋀㋁㋂㋃㋄㋅㋆㋇㋈㏠㏡㏢㏣㏤㏥㏦㏧㏨❶❷❸❹❺❻❼❽❾❿]", "img");
        private static var SpecialNumReg:RegExp = new RegExp("[^ЧㄹｌＯ１２３４５６７８９０①②③④⑤⑥⑦⑧⑨⑩⓪⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛㈠㈡㈢㈣㈤㈥㈦㈧㈨⑴⑵⑶⑷⑸⑹⑺⑻⑼㍘㍙㍚㍛㍜㍝㍞㍟㍠㍡㋀㋁㋂㋃㋄㋅㋆㋇㋈㏠㏡㏢㏣㏤㏥㏦㏧㏨❶❷❸❹❺❻❼❽❾❿]", "img");
        private static var regIndex:int = 0;
        private static var tipsArray:Array;

        public function ChatFraudFilter()
        {
            return;
        }// end function

        public static function set source(param1:Array) : void
        {
            var _loc_2:Object = null;
            if (param1 != null)
            {
                _source = param1;
                for each (_loc_2 in _source)
                {
                    
                    _loc_2.rep = new RegExp(_loc_2.rep, "ig");
                    _loc_2.point = parseFloat(_loc_2.point);
                }
            }
            return;
        }// end function

        public static function isChatFraud(param1:String) : Boolean
        {
            var _loc_3:Object = null;
            var _loc_2:Number = 0;
            for each (_loc_3 in _source)
            {
                
                if (param1.search(_loc_3.rep) > -1)
                {
                    _loc_2 = _loc_2 + _loc_3.point;
                    if (_loc_2 >= LIMITVALUE)
                    {
                        return true;
                    }
                }
            }
            return false;
        }// end function

        public static function hasQQInfo(param1:String) : Boolean
        {
            var _loc_2:* = new RegExp("[IO1234567890ЧㄹｌＯ１２３４５６７８９０①②③④⑤⑥⑦⑧⑨⑩⓪⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛ⅠⅡⅢⅣⅤⅥⅦⅧⅨ㈠㈡㈢㈣㈤㈥㈦㈧㈨⑴⑵⑶⑷⑸⑹⑺⑻⑼零壹贰叁肆伍陆柒捌玖一二三四五六七八九—十万百㍘㍙㍚㍛㍜㍝㍞㍟㍠㍡㋀㋁㋂㋃㋄㋅㋆㋇㋈㏠㏡㏢㏣㏤㏥㏦㏧㏨❶❷❸❹❺❻❼❽❾❿]{7,13}", "img");
            return _loc_2.test(param1);
        }// end function

        public static function delSpecialSymbols(param1:String) : String
        {
            return param1.replace(DelReg, "");
        }// end function

        public static function replaceSecialNumSymbols(param1:String) : String
        {
            if (param1.replace(SpecialNumReg, "").length >= 1)
            {
                return getRandomTip();
            }
            return param1;
        }// end function

        public static function getRandomTip() : String
        {
            if (!tipsArray)
            {
                tipsArray = new Array();
                tipsArray.push("风暴大陆还好玩的");
                tipsArray.push("这游戏有点意思");
                tipsArray.push("这游戏还不错啊");
            }
            var _loc_1:* = MathUitl.random(0, (tipsArray.length - 1));
            return tipsArray[_loc_1];
        }// end function

    }
}
